'   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 '           N a m e :   W X M _ L A S E R t e s t _ 0 . t x t                           D a t e :   2 6   S e p t e m b e r   2 0 1 9 
 
 '         A u t o r :   L e o n a r d o   D E   P A L O   P h . D . 
 
 '         S c o p e :   S t r e s s   t e s t   L A S E R   b e a m   s e n s o r 
 
 '   H a r d w a r e :   U s i n g   t h e   o l d   c a r t e s i a n   s y s t e m . 
 
 '   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' 
 
 '   = = = = = = = = = = =   M I C R O S T E P   H A R D W A R E   S E T   U P     = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 ' L o a d   B M _ F o u n d a t i o n 0 . j p g 
 
 
 
 ' = = = = = = = = = = = = = = = =   G E N E R A T I N G   T H E   L O G   F I L E   N A M E   = = = = = = = = = = = = = = = = = = = = = 
 
 s 2   =   " L A S E R _ T E S T . t x t " 
 
 S 9   =   " -   D a t e   -   "   +   "   -   T I M E   -   "   +   "   C y c l e   "   +   "   R E S U L T   " 
 
 '         9 / 1 1 / 2 0 1 9   1 3 : 2 3 : 3 2     0 0 0 2   - 1 . 0 0 1   - 0 . 0 0 1   - 5 . 9 9 8   0 . 0 0 2 
 
 S a v e   S t r i n g T o F i l e   s 9   s 2 
 
 ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 S p e e d   9 
 
 B u t t o n   1   T e x t   " H O M E   A l l " 
 
 
 
 B u t t o n   3   T e x t   " L A S E R   T E S T " 
 
 
 
 L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ H A L . e x e 
 
 L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t V i e w e r . e x e 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ M e d i a P l a y e r . e x e 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ T e r m i n a l . e x e 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ S l o t s T o S p e e c h . e x e 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ M i c r o V i d e o . e x e 
 
 ' L o a d   T h e r e m i n o _ H A L \ T h e r e m i n o _ S i g n a l S c o p e . e x e 
 
 
 
 V a r i a b l e   N u m e r i c   D i g i t T i m e 
 
 V a r i a b l e   N u m e r i c   N u m T e s t 
 
 V a r i a b l e   N u m e r i c   N u m C y c l e s 
 
 
 
 V a r i a b l e   N u m e r i c   C o o r d _ Z 
 
 V a r i a b l e   N u m e r i c   C o o r d _ A 
 
 V a r i a b l e   N u m e r i c   C o o r d _ X P 
 
 V a r i a b l e   N u m e r i c   C o o r d _ X R 
 
 
 
 V a r i a b l e   N u m e r i c   S l o t M o t o r 
 
 V a r i a b l e   N u m e r i c   S l o t S e n s o r 
 
 V a r i a b l e   N u m e r i c   S p e e d S e a r c h 
 
 V a r i a b l e   N u m e r i c   S p e e d R e t u r n 
 
 V a r i a b l e   N u m e r i c   D e c l a r e d Z e r o 
 
 V a r i a b l e   N u m e r i c   I n i t i a l P o s i t i o n 
 
 
 
 V a r i a b l e   S t r i n g   I n f o 
 
 V a r i a b l e   S t r i n g   R e s u l t 
 
 
 
 D i g i t T i m e   =   1 . 4 
 
 C o o r d _ X P   =   1 9 3 
 
 C o o r d _ X R   =   1 7 5 
 
 
 
 K e y   R i g h t 	 	 G o s u b   M o v e R i g h t M 0 
 
 K e y   L e f t   	 	 G o s u b   M o v e L e f t M 0 
 
 K e y   U p   	 	 	 G o s u b   M o v e R i g h t M 1 
 
 K e y   D o w n   	 	 G o s u b   M o v e L e f t M 1 
 
 K e y   P a g e u p 	 	 G o s u b   M o v e U p M 2 
 
 K e y   P a g e d o w n 	 G o s u b   M o v e D o w n M 2 
 
 K e y   S 	 	 	 G o s u b   " S T A R T   T E S T " 
 
 
 
 G o s u b   R E D 
 
 S t o p 
 
 
 
 '   = = = = = = = = = = = = = = =   L A S E R   B E A M   S E N S O R   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " L A S E R   T E S T " 
 
 	 S a v e   S t r i n g T o F i l e   " - = - = - = - L A S E R _ T E S T _ S T A R T - = - = - = - "   s 2 
 
 	 ' N u m T e s t   =   I n p u t   " T e l l   m e   h o w   m a n y   c y c l e : " 
 
 	 N u m T e s t   =   1 0 0 
 
 	 G o s u b   " H O M E   A l l " 
 
 	 N u m C y c l e s   =   0 
 
 	 L a b e l   L A S E R L o o p T e s t 
 
 	 	 N u m C y c l e s   =   N u m C y c l e s   +   1 
 
 	 	 I f   N u m C y c l e s   >   N u m T e s t 
 
 	 	 	 G o s u b   " H O U S E " 
 
 	 	 	 G o s u b   " L A S E R   T E S T " 
 
 	 	 	 R e t u r n 
 
 	 	 E n d I f 
 
 	 	 S l o t ( 3 0 )   =   1 0 0 0 	 	 	 	 	 	 	 ' L A S E R   O N 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 S l o t ( 2 5 )   =     8 0           	 	 	 	 	 	 ' M o v e   t o   t h e   p r e c h e c k   p o s i t i o n 
 
 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 I f   S l o t ( 3 2 )   >   5 0 0 
 
 	 	 	 R e s u l t   =   "   B e f o r e   P A S S " 
 
 	 	 	 G o s u b   G R E 
 
 	 	 E l s e 
 
 	 	 	 R e s u l t   =   "   B e f o r e   < < < F A I L > > > " 	 	 '   S e n s o r   N O T   r e c e i v e   t h e   b e a m 
 
 	 	 	 G o s u b   R E D 
 
 	 	 E n d I f 
 
 	 	 s 1   =   N o w 
 
 	 	 s 1   =   s 1   +   "   "   +   F o r m a t ( N u m C y c l e s ,   " 0 0 0 0 0 " )   +   "   "   +   R e s u l t 
 
 	 	 P r i n t   s 1 
 
 	 	 S a v e   S t r i n g T o F i l e   s 1   s 2 
 
 	 	 
 
 	 	 S l o t ( 2 5 )   =     5 8           	 	 	 	 	 	 '   6 2   B r e a b   t h e   b e a m 
 
 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 I f   S l o t ( 3 2 )   <   5 0 0 
 
 	 	 	 R e s u l t   =   "   B r e a c k   P A S S "   	 	 	 	 '   b r e a c k   t h e   L A S E R   b e a m 
 
 	 	 	 G o s u b   G R E 
 
 	 	 E l s e 
 
 	 	 	 R e s u l t   =   "   B r e a c k   < < < F A I L > > > " 	 	 	 ' 
 
 	 	 	 G o s u b   R E D 
 
 	 	 E n d I f 
 
 	 	 s 1   =   N o w 
 
 	 	 s 1   =   s 1   +   "   "   +   F o r m a t ( N u m C y c l e s ,   " 0 0 0 0 0 " )   +   "   "   +   R e s u l t 
 
 	 	 P r i n t   s 1 
 
 	 	 S a v e   S t r i n g T o F i l e   s 1   s 2 
 
 	 	 
 
 	 	 S l o t ( 2 5 )   =     8 0           	 	 	 	 	 	 ' M o v e   t o   t h e   p r e c h e c k   p o s i t i o n 
 
 	 	 G o s u b   W a i t A l l M o t o r s 
 
 	 	 I f   S l o t ( 3 2 )   >   5 0 0 
 
 	 	 	 R e s u l t   =   "   A f t e r     P A S S " 	   	 	 	 '   S e n s o r   r e c e i v e   t h e   b e a m 
 
 	 	 	 G o s u b   G R E 
 
 	 	 E l s e 
 
 	 	 	 R e s u l t   =   "   A f t e r   < < < F A I L > > > " 	 	 	 '   S e n s o r   N O T   r e c e i v e   t h e   b e a m 
 
 	 	 	 G o s u b   R E D 
 
 	 	 E n d I f 
 
 	 	 s 1   =   N o w 
 
 	 	 s 1   =   s 1   +   "   "   +   F o r m a t ( N u m C y c l e s ,   " 0 0 0 0 0 " )   +   "   "   +   R e s u l t 
 
 	 	 P r i n t   s 1 
 
 	 	 S a v e   S t r i n g T o F i l e   s 1   s 2 
 
 	 	 
 
 	 	 S l o t ( 3 0 )   =   0 	 	 	 	 	 	 	 '   L A S E R   O F F 
 
 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 G o t o   L A S E R L o o p T e s t 
 
 R e t u r n 
 
 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 ' - - - - -   S   U   B   R   O   U   T   I   N   E       A   R   E   A     - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 ' - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
 
 '   = = = = = = = = = = = = = = =   H O M E   A L L   M O T O R s   M 0 ,   M 1 ,   M 2   = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " H O M E   A l l " 
 
 	 G o s u b   B L U 
 
 	 S l o t ( 1 )   =   S l o t ( 1 )   -   5 
 
 	 G o s u b   " H o m e   M 3 ( A ) " 
 
 	 G o s u b   " H o m e   M 2 ( Z ) " 
 
 	 G o s u b   " H o m e   M 1 ( Y ) " 
 
 	 G o s u b   " H o m e   M 0 ( X ) " 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m e   M 0 ( X ) " 
 
 	 S l o t M o t o r   =   1 
 
 	 S l o t S e n s o r   =   1 9 
 
 	 S p e e d S e a r c h   =   - 0 . 1 
 
 	 S p e e d R e t u r n   =   + 0 . 0 0 5 
 
 	 D e c l a r e d Z e r o   =   0 
 
 	 I n i t i a l P o s i t i o n   =   1 
 
 	 G o s u b   " H o m e " 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m e   M 1 ( Y ) " 
 
 	 S l o t M o t o r   =   3 
 
 	 S l o t S e n s o r   =   2 0 
 
 	 S p e e d S e a r c h   =   - 0 . 1 
 
 	 S p e e d R e t u r n   =   + 0 . 0 5 
 
 	 D e c l a r e d Z e r o   =   0 
 
 	 I n i t i a l P o s i t i o n   =   1 
 
 	 G o s u b   " H o m e " 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m e   M 2 ( Z ) " 
 
 	 S l o t M o t o r   =   5 
 
 	 S l o t S e n s o r   =   2 1 
 
 	 S p e e d S e a r c h   =   + 0 . 1 
 
 	 S p e e d R e t u r n   =   - 0 . 0 0 5 
 
 	 D e c l a r e d Z e r o   =   1 0 3 
 
 	 I n i t i a l P o s i t i o n   =   1 0 0 
 
 	 G o s u b   " H o m e " 
 
 R e t u r n 
 
 
 
 L a b e l   " H o m e   M 3 ( A ) " 
 
 	 S l o t M o t o r   =   2 5 
 
 	 S l o t S e n s o r   =   3 1 
 
 	 S p e e d S e a r c h   =   - 0 . 0 8 
 
 	 S p e e d R e t u r n   =   + 0 . 0 5 
 
 	 D e c l a r e d Z e r o   =   0 
 
 	 I n i t i a l P o s i t i o n   =   1 
 
 	 G o s u b   " H o m e " 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   H O U S E   A L L   M O T O R S   M 0 ,   M 1 ,   M 3   = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " H O U S E " 
 
 	 G o s u b   B L U 
 
 	 S l o t ( 5 )     =     9 8 	   	 ' Z   R a i s e 
 
 	 G o s u b   W a i t A l l M o t o r s 
 
 	 S l o t ( 1 )     =     2           	 ' X   g o   t o   H O U S E 
 
 	 S l o t ( 2 5 )   =     2           	 ' A   g o   t o   H O U S E 
 
 	 G o s u b   W a i t A l l M o t o r s 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   H O M E   M O T O R   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   " H o m e " 
 
 	 G o s u b   B l u 
 
 	 I f   S l o t ( S l o t S e n s o r )   >   5 0 0             '   d e t a c h   i f   s e n s o r   a c t i v e 
 
 	 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d R e t u r n 
 
 	 E n d I f 
 
 ' 
 
 L a b e l   S e a r c h H o m e 
 
 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d S e a r c h 
 
 	 W a i t   S e c o n d s   0 . 0 0 1 
 
 	 I f   S l o t ( S l o t S e n s o r )   >   5 0 0   	 '   l i m i t   s w i t c h 
 
 	 	 G o s u b   W a i t M o t o r 	 	 	 '   W A I T   U N T I L   M O T O R   S T O P 
 
 	 	 G o t o   D e t a c h S e n s o r 
 
 	 E n d I f 
 
 G o t o   S e a r c h H o m e 
 
 ' 
 
 L a b e l   D e t a c h S e n s o r 
 
 	 S l o t ( S l o t M o t o r )   =   S l o t ( S l o t M o t o r )   +   S p e e d R e t u r n   '   d i r e c t i o n / s p e e d   r e t u r n 
 
 	 W a i t   S e c o n d s   0 . 0 0 1 
 
 	 I f   S l o t   ( S l o t S e n s o r )   <   5 0 0 
 
 	 	 G o s u b   W a i t M o t o r 
 
 	 	 G o t o   A s s i g n Z e r o 
 
 	 E n d I f 
 
 G o t o   D e t a c h S e n s o r 
 
 ' 
 
 L a b e l   A s s i g n Z e r o 
 
 	 S l o t ( S l o t M o t o r )   =   R e s e t 	 	 	 '   R e s e t   t h e   s l o t   v a l u e 
 
 	 W a i t   S e c o n d s   0 . 0 8 	 	     	 	 '   D O   N O T   T O U C H ,   n e e d e d   t o   t h e   M a s t e r ! ! ! ! 
 
 	 S l o t ( S l o t M o t o r )   =   D e c l a r e d Z e r o 
 
 	 G o s u b   W a i t M o t o r 
 
 	 S l o t ( S l o t M o t o r )   =   I n i t i a l P o s i t i o n 
 
 	 G o s u b   B L U 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   W   A   I   T   u n t i l   t h e   m o t o r ( S l o t M o t o r )   i s   s t o p p e d   = = = = = = = = 
 
 L a b e l   W a i t M o t o r 
 
 '   - - - - - - - - - - - - - - - - - -   t h i s   W a i t   e n s u r e s   t h a t   t h e   m o t o r s   i a   r u n n i n g 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 L a b e l   W a i t 1 
 
 	 	 I f   A b s ( S l o t ( S l o t M o t o r   +   1 ) )   <   0 . 0 1 
 
 	 	 	 R e t u r n 	 	 	 '   n o w   t h e   m o t o r   i s   n o t   r u n n i n g 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 0 5 
 
 	 G o t o   W a i t 1 
 
 '   - - - - - - - - - - - - - - - - - -   t h i s   l i n e   i s   r e q u i r e d   t o   i n d e n t   c o r r e c t l y 
 
 G o t o   W a i t M o t o r 
 
 
 
 '   = = = = = = = = = = = = = = =   W   A   I   T     a l l   M O T O R S   a r e   S T O P P E D   = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   W a i t A l l M o t o r s 
 
 '   - - - - - - - - - - - - - - - - - -   t h i s   W a i t   e n s u r e s   t h a t   t h e   m o t o r s   a r e   r e a l l y   s t a r t e d 
 
 	 W a i t   S e c o n d s   0 . 1 
 
 	 L a b e l   W a i t A l l M o t o r s 2 
 
 	 	 I f   A b s ( S l o t ( 2 ) )   <   0 . 0 1   A n d   A b s ( S l o t ( 4 ) )   <   0 . 0 1   A n d   A b s ( S l o t ( 6 ) )   <   0 . 0 1   A n d   A b s ( S l o t ( 2 6 ) )   <   0 . 0 1 
 
 	 	 	 R e t u r n 
 
 	 	 E n d I f 
 
 	 	 W a i t   S e c o n d s   0 . 0 1 
 
 	 G o t o   W a i t A l l M o t o r s 2 
 
 '   - - - - - - - - - - - - - - - - - -   t h i s   l i n e   i s   r e q u i r e d   t o   i n d e n t   c o r r e c t l y 
 
 G o t o   W a i t A l l M o t o r s 
 
 
 
 '   = = = = = = = = = = = = = = =   E N A B L E   /   D I S A B L E   M O T O R S   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' L a b e l   E n a b l e M o t o r 
 
 ' 	 S l o t   1 1   =   0 
 
 ' 	 W a i t   S e c o n d s   0 . 2 
 
 ' R e t u r n 
 
 ' 
 
 ' L a b e l   D i s a b l e M o t o r 
 
 ' 	 S l o t   1 1   =   1 0 0 0 
 
 ' 	 W a i t   S e c o n d s   0 . 2 
 
 ' R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   P A U S E   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   P a u s e 
 
 	 L a b e l   P a u s e L o o p 
 
 	 	 I f   S l o t ( 1 2 )   >   5 0 0 
 
 	 	 	 S l o t ( 2 9 )   =   1 0 0 0 
 
 	 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 	 S l o t ( 2 9 )   =   0 
 
 	 	 	 W a i t   S e c o n d s   0 . 1 
 
 	 	 E l s e 
 
 	 	 	 ' G o s u b   R E D 
 
 	 	 	 ' W a i t   S e c o n d s   0 . 1 
 
 	 	 	 ' G o s u b   G R E 
 
 	 	 	 ' W a i t   S e c o n d s   0 . 1 
 
 	 	 	 ' G o s u b   B L U 
 
 	 	 	 ' W a i t   S e c o n d s   0 . 1 
 
 	 	 	 R e t u r n 
 
 	 	 E n d I f 
 
 	 	 G o s u b   R E D 
 
 	 G o t o   P a u s e L o o p 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   T R A F F I C   L I G H T   C O L O R   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   R E D 
 
 	 S l o t   1 6   =   8 0 0 	 	 ' R E D 
 
 	 S l o t   1 7   =         0 	 	 ' G R E 
 
 	 S l o t   1 8   =         0 	 	 ' B L U 
 
 R e t u r n 
 
 
 
 L a b e l   G R E 
 
 	 S l o t   1 6   =         0 	 	 ' R E D 
 
 	 S l o t   1 7   =     8 0 0 	 	 ' G R E 
 
 	 S l o t   1 8   =         0 	 	 ' B L U 
 
 R e t u r n 
 
 
 
 L a b e l   B L U 
 
 	 S l o t   1 6   =         0 	 	 ' R E D 
 
 	 S l o t   1 7   =         0 	 	 ' Y E L 
 
 	 S l o t   1 8   =     8 0 0 	 	 ' B L U 
 
 R e t u r n 
 
 
 
 '   = = = = = = = = = = = = = = =   M O V E   U S I N G   K E Y B O A R D   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 L a b e l   M o v e R i g h t M 0 
 
 	 S l o t ( 1 )   =   S l o t ( 1 )   +   1 
 
 	 R e t u r n 
 
 L a b e l   M o v e L e f t M 0 
 
 	 S l o t ( 1 )   =   S l o t ( 1 )   -   1 
 
 	 R e t u r n 
 
 L a b e l   M o v e R i g h t M 1 
 
 	 S l o t ( 2 5 )   =   S l o t ( 2 5 )   +   1 
 
 	 R e t u r n 
 
 L a b e l   M o v e L e f t M 1 
 
 	 S l o t ( 2 5 )   =   S l o t ( 2 5 )   -   1 
 
 	 R e t u r n 
 
 L a b e l   M o v e U p M 2 
 
 	 S l o t ( 5 )   =   S l o t ( 5 )   +   1 
 
 	 R e t u r n 
 
 L a b e l   M o v e D o w n M 2 
 
 	 S l o t ( 5 )   =   S l o t ( 5 )   -   1 
 
 R e t u r n 
 
 
 
 ' = = = = = =   D U M M Y   A R E A   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' = = = = = =   T O   D O   A R E A   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 ' = = = = = =   S E T   U P   A R E A   = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 
 
 
 
 
 
 ' W A T C H   A b s ( S l o t ( S l o t M o t o r ) ) 
 
 ' W A T C H   s 2 
 
 ' W A T C H   S l o t M o t o r 
 
 ' W A T C H   A b s ( S l o t ( S l o t M o t o r ) ) 
 
 ' W A T C H   A b s ( S l o t ( S l o t M o t o r ) ) 
 
 ' E X E C   S i n 2   =   S i n ( 3 3 ) 
 
 